{% extends "base.html" %}
{% block head %}
<style>
	input[type=text]{
		width:100%;
		height:30px;
		padding-left:10px;
	}
	#addCateg{
		margin-right:740px;
	}
	#addCateg p{
		margin:20px 0 4px 0;
	}
	#addCateg .submit{
		margin-top:20px;
	}
	#categList{
		width:700px;
		float:right;
		margin-right:10px;
		
	}
	#categList th,#categList td{
		text-align:left;
		padding-left:10px;
	}
	#categList table{
		width:100%;
		-khtml-border-radius:5px;
		-webkit-border:5px;
		border-radius:5px;
		border:solid 1px #ccc;
	}
	#categList th{
		background:#eee;
		height:30px;
		border-bottom:solid 1px #ccc;
	}
	#categList tbody{
		border:solid 1px #D9D9D9;
		border-width:0 1px 1px 1px;
	}
	#categList th:first-of-type{
		-webkit-border-top-left-radius:5px;
		width:50px;
	}
	#categList th:last-of-type{
		border-top-right-radius:5px;
	}
	#categList .operate{
		height:30px;
		padding-top:5px;
	}
	#categList .categ{
		text-align:left;
	}
</style>
<script>
	$(function(){
		$('#categList .selectAll').click(function(){
			var select=$('.categListBody .select');
			if(this.checked==true)
			{
				select.attr('checked',true);
			}
			else
			{
				select.attr('checked',false);
			}
		});
		
		
		var operateCateg=$('#operateCateg');
		$('.operate select').change(function(){
			var attr=operateCateg.attr('action');
			attr=attr+'?mode='+this.value;
			operateCateg.attr('action',attr);
		});
	})
</script>
{% endblock %}
{% block contentWrap %}
	<form action="../admin/manageCateg" method="post" id="operateCateg">
	<div id="categList">
		<div class="operate">
			<select>
				<option>批量操作</option>
				<option value="delete">删除</option>
			</select>
			<input type="submit" value="应用" />
		</div>
		<table>
			<thead>
				<tr>
					<th><input type="checkbox" class="selectAll"/></th>
					<th>名称</th>
					<th>别名</th>
					<th>文章</th>
				</tr>
			</thead>
			<tbody class="categListBody">
				{% for categ in categs %}
				<tr>
					<td><input type="checkbox" class="select" value="{{categ.id}}" name="deleteId"/></td>
					<td class="categ"><a href="/admin/editCateg?id={{categ.id}}">{{categ.name}}</a></td>
					<td>{{categ.alias}}</td>
					<td><a href="">{{categ.postCount}}</a></td>
				</tr>
				{% endfor %}
			</tbody>
		</table>
		<div class="operate">
			<select>
				<option>批量操作</option>
				<option value="delete">删除</option>
			</select>
			<input type="submit" value="应用" />
		</div>
	</div>	
	</form>	
	<form action="../admin/manageCateg" method="post">
		<div id="addCateg">
			<h2>添加新分类目录</h2>
			<p>名称</p>
			<input type="text" name="categName" /><br />
			<span>这将是它在站点上显示的名字。</span>
			<p>别名</p>
			<input type="text" name="alias" /><br />
			<span>“别名”是对于 URL 友好的一个别称。它通常为小写并且只能包含字母，数字和连字符（-）。</span>
			<div><input type="submit" value="添加新分类目录" class="submit"/></div>
		</div>
	</form>
{% endblock %}
